home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
zindent7.zip
/
ZINDENT7.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-03-30
|
12KB
|
407 lines
(*<<<>>>*)
(*******************************************************************)
(**) (**)
(**) PROGRAM ZINDENT ; (**)
(**) (**)
(*******************************************************************)
CONST
SysTitle =
'zINDENT.PAS, v. 7.D, Indent for dBASE / Turbo Pascal Source Files';
SysVersion1 = 'Command via : Line / File / User';
SysVersion2 = 'MSDOS version 0300pm, mon, 30.Mar.87, Glen Ellis';
SysCredit = 'Apple/CPM and MSDOS tested. ';
SysPgmName = 'ZINDLIST.DAT'; (* file containing filename list *)
SysCpuSpeed = 2 ; (* author's writing/developmental system is 2 MHz ! *)
(* parameters FOR Compiler *)
{$C+}
{$U+} (* $U+ User Interrupt benchmarks almost same as $U- *)
{$F4}
(* parameters FOR LISTT.PAS, Borland's advanced Lister program *)
{.U+}
{.N-}
{.P-}
{.PO0}
(*####################################################################*)
(*$I c:zinVAR.INC*) (* for core program *)
(*$I C:zinSTR.INC*) (* required string utilties *)
(*$I C:zinSCR.INC*) (* screen display procedures *)
(*$I C:zinDOC.INC*) (* system documentation / readme.inc *)
(* C:ZReadme.INC*) (* not Pascal include file *)
(*$I C:zinUTL.INC*) (* miscelaneous procedures *)
(*$I C:zinDSK.INC*) (* disk file procedures *)
(*$I C:zinKEYDB.INC*) (* keyword dBASE *)
(*$I C:zinKEYTP.INC*) (* keyword Pascal *)
(********************************************************************)
BEGIN (* MAIN *)
(*=======> INIT <=======*)
(* programmer's options *)
SysDisplay := true ; (* always true *)
SysUserTrace := true ; (* normal : display program path *)
SysPgmTrace := false ; (* audit developmental path *)
SysSpcTrace := false ; (* special, temporary *)
(* name/function of procedure *) (* located in this file *)
(* *) (* *)
pSayHeader; (* Display header *) (* SysScr.inc *)
IF not SysPgmTrace then pDelay2;
(*=======> FETCH <=======*)
(* initz *)
SysPgmMod := ' ' ;
(* fetch command line from either paramstring or paramfile
(* set defaults for operational vars :
(* Filename, Indent, Comment, LineCount, Vertiate
*)
(* set mode flags true *)
(* ZinLine.Inc will re-assign *)
SysCmdLine := true ; (* enable Command Line Parse *)
SysCmdFile := false; (* file names via text file *)
SysCmdUser := false; (* direct keyboard entry *)
(* parameter flags : if satisfied, then lower flag *)
SysCmdUserFile := false ; (* filename fetch *)
SysCmdUserParm := false ; (* parameter fetch *)
(*=======> FETCH LINE ENTRY *)
IF SysCmdLine then
begin
IF SysPgmTrace then
begin
writeln; writeln;
writeln('--> SysCmdLINE');
pDelay1;
end;
(*$I c:zinLINE.INC*) (*:::*)
(* if user entered no command line, or requested Docs, then *)
(* pause while he reads header *)
If (SysInFileName = '?') then
begin
writeln; writeln;
writeln('User Entry / Documentation has been enabled . . . .');
pKeyPressed;
end;
end;
(*=======> FETCH FILE ENTRY *)
IF SysCmdFile then
begin
IF SysPgmTrace then
begin
writeln('---> SysCmdFILE');
pDelay1;
end;
SysInFileName := SysPgmName; (* read data file name *)
(*$I c:zinFILE.INC*) (*:::*)
end;
(*=======> FETCH USER ENTRY *)
IF ( (SysCmdUser) and (SysCmdUserFile) )
or
( (SysCmdUser) and (SysCmdUserparm) )
then
begin
IF SysPgmTrace then
begin
writeln('---> SysCmdUSER');
pDelay1;
end;
(*$I c:zinUSER.INC*) (*:::*)
end;
(*=======> CORE CONTROLLER <=======*)
(* if filename and parameters installed *)
IF (SysCmdLine) or (SysCmdFile) or (SysCmdUser)
then SysEnableCORE := true
ELSE SysEnableCORE := false;
IF SysUserTrace then (* display list of file names *)
begin
writeln('SysUserTrace enabled');
pSayFileList; (*::: SysUtl.INC *)
end;
IF SysPgmTrace then
begin
pSaySysVar; (* big VAR display prior to CORE *)
end;
(*=======> CORE <=======*)
IF SysEnableCore then
begin
IF SysPgmTrace then
begin
writeln('--- Enable Core ---');
pDelay1;
end;
(* init : cmdline/cmdfile/cmduser *)
IF (SysInSourceMax = 0)
then SysInSourceMax := 1;
(*=========================================*)
FOR SysInSourceCnt := 1 to SysInSourceMax do
begin (* Count Through InSource Array of FileNames *)
(* fetch new filename *)
(* parse for .typ *)
(* start file *)
(* read loop *)
(* load the carrier memvar *)
SysInFileName := SysInSource[SysInSourceCnt];
writeln('FileName : ', SysInFileName,' :');
pDelay1;
(*=======> Parse file.typ for mode : OL, DB, TP *)
(*:::*)
(* can be preset (forced) by user in SysUser.Inc. *)
(* default entry is ' '. *)
if (SysPgmMod = ' ') then
begin
pSysParse( SysInFileName, SysPgmMod, SPMSL, SPMSR );
(*::: SysDsk.INC *)
(* IF SysPgmTrace then *)
(* begin *)
writeln('Results of FileName Parse :',SysPgmMod,':');
pDelay1;
(* end; *)
end;
(*=======> Start Files *)
(* create three file.type vars for .BAK, .(source), .$$$
(* Open, Reset, Rewrite files *)
IF SysPgmTrace then
begin
writeln;
writeln('--- Start Files ---');
pDelay1;
end;
SysIOcheck := true ; (* any one dead file will skip loop one time ! *)
pSysStartFiles(SysIOcheck); (*::: SysUtl.INC *)
(*---------------*)
IF SysIOcheck then
begin
IF SysUserTrace then
begin
writeln;
writeln('--- Start Read Loop --- ',SysInFileName);
pDelay1;
end;
(* prep for linecnt during WHILE loop *)
SysLineNum := 0;
(* operational var set to zero *)
pSysLvlInit; (*::: SysUtl.INC *)
(*=======> Scan Through File *)
WHILE not (eof(SysInFile))
do
begin
(* read text line from input file *)
readln(SysInFile,SysInLine);
(* assign output string to value read in *)
SysOutLine := SysInLine;
(* writing parms are long for indentifiability *)
(* procedure parms are small so line will be < 127 *)
(* update short vars *)
pSysVarShortUPdt; (*::: SysUtl.INC *)
(*===================================================
(*
(* current KeyWord module application flow:
(*
(* identify KEYWORD, and adjust indent
(* SysUserTrace start/stop of structures
(* toggle sysmarkwrite
(* OutSTR = exit line
(* indentPOS = current left margin position
(* indentNUM = actual indent group length
(* lineMAX = max length of text line = 79
(* markWRITE = enable comments write to disk
(**)
(*
(* Indent for dBASE-II
(**)
IF SysPgmMod = 'DB'
then
pKEYDB( SOLL, SIP, SIN, SLM, SMW, SLI, SLC, SLW);
(*::: KeyDB.INC*)
(*
(* Indent for Turbo Pascal